package com.wuchao.spring.aop.aspect;

import com.wuchao.pojo.Users;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

import java.util.Arrays;

/**
 * @Author wuchao66
 * @Date 2022/9/26 11:56
 * @PackageName:com.wuchao.spring.aop.aspect
 * @ClassName: TheAopAspect
 * @Description: TODO
 * @Param
 * @Version 1.0
 */
@Slf4j
@Aspect
public class TheAopAspect {//切面+增强处理
    @Before(value = "execution(* com.wuchao.spring.aop.*.*.show1(com.wuchao.pojo.Users))")
    public void before(JoinPoint jp) {
        log.info("我是切面中的前置增强");
        log.info("调用" + jp.getTarget() + "的" + jp.getSignature().getName() + "方法。方法入参:" + Arrays.toString(jp.getArgs()));
    }
    /*public void show(Users users){
        log.info(users.getName());
    }*/
    public void afterReturning(JoinPoint jp, Object result) {
        log.info("我是切面中的后置增强");
        log.info("调用" + jp.getTarget() + "的" + jp.getSignature().getName() + "方法。方法返回值:" + result);
    }

}
